package com.whately.core.base.keygen;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class CommonIdGenerateFactory {

    private static SnowIdUtil SNOW_ID_GENERATOR;

    @Autowired
    public CommonIdGenerateFactory(WhatelyMachineCodeHelper whatelyMachineCodeHelper){
        log.info("CommonIdGenerateFactory init ,whatelyMachineCodeHelper desc {} ",  whatelyMachineCodeHelper.desc());
        SNOW_ID_GENERATOR =new SnowIdUtil();

   }


    /**
     * 19位雪花id
     */
    public static long snowId(){
        return SNOW_ID_GENERATOR.nextId();
    }


}
